<template>
  <div class="system-settings">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>系统设置</span>
      </div>

      <!-- 测试环境配置 -->
      <el-card class="box-card" style="margin-top: 20px;">
        <div slot="header" class="clearfix">
          <span>测试环境配置</span>
        </div>
        <el-form :model="testEnvConfig" label-width="150px">
          <el-form-item label="Gas限制">
            <el-input-number v-model="testEnvConfig.gasLimit" :min="1000" :max="10000000" label="Gas Limit" />
          </el-form-item>
          <el-form-item label="最大栈深度">
            <el-input-number v-model="testEnvConfig.maxStackDepth" :min="10" :max="1024" label="Max Stack Depth" />
          </el-form-item>
          <el-form-item label="存储大小">
            <el-input-number v-model="testEnvConfig.storageSize" :min="10" :max="1024" label="Storage Size (MB)" />
          </el-form-item>
        </el-form>
      </el-card>

      <!-- 测试用例生成配置 -->
      <el-card class="box-card" style="margin-top: 20px;">
        <div slot="header" class="clearfix">
          <span>测试用例生成配置</span>
        </div>
        <el-form :model="testCaseConfig" label-width="150px">
          <el-form-item label="生成操作码范围">
            <el-select v-model="testCaseConfig.opcodeRange" placeholder="请选择生成的操作码范围">
              <el-option label="所有操作码" value="all" />
              <el-option label="基本操作码" value="basic" />
              <el-option label="高级操作码" value="advanced" />
            </el-select>
          </el-form-item>
          <el-form-item label="变异生成频率">
            <el-slider v-model="testCaseConfig.mutationFrequency" :min="0" :max="100" />
          </el-form-item>
        </el-form>
      </el-card>

      <!-- 变异策略设置 -->
      <el-card class="box-card" style="margin-top: 20px;">
        <div slot="header" class="clearfix">
          <span>变异策略设置</span>
        </div>
        <el-form :model="mutationStrategyConfig" label-width="150px">
          <el-form-item label="条件操作符权重">
            <el-slider v-model="mutationStrategyConfig.conditionalOperatorWeight" :min="0" :max="1" :step="0.01" />
          </el-form-item>
          <el-form-item label="算术操作符权重">
            <el-slider v-model="mutationStrategyConfig.arithmeticOperatorWeight" :min="0" :max="1" :step="0.01" />
          </el-form-item>
          <el-form-item label="循环操作符权重">
            <el-slider v-model="mutationStrategyConfig.loopOperatorWeight" :min="0" :max="1" :step="0.01" />
          </el-form-item>
          <el-form-item label="迭代限制">
            <el-input-number v-model="mutationStrategyConfig.iterationLimit" :min="1" :max="1000" label="迭代次数" />
          </el-form-item>
          <el-form-item label="性能阈值">
            <el-input-number v-model="mutationStrategyConfig.performanceThreshold" :min="1" :max="100" label="性能阈值 (%)" />
          </el-form-item>
        </el-form>
      </el-card>

      <!-- 日志和报告设置 -->
      <el-card class="box-card" style="margin-top: 20px;">
        <div slot="header" class="clearfix">
          <span>日志与报告设置</span>
        </div>
        <el-form :model="logConfig" label-width="150px">
          <el-form-item label="日志详细级别">
            <el-select v-model="logConfig.logLevel" placeholder="请选择日志级别">
              <el-option label="详细" value="verbose" />
              <el-option label="普通" value="normal" />
              <el-option label="简略" value="minimal" />
            </el-select>
          </el-form-item>
          <el-form-item label="报告输出格式">
            <el-select v-model="logConfig.reportFormat" placeholder="请选择报告格式">
              <el-option label="PDF" value="pdf" />
              <el-option label="HTML" value="html" />
              <el-option label="JSON" value="json" />
            </el-select>
          </el-form-item>
        </el-form>
      </el-card>

      <!-- 系统信息 -->
      <el-card class="box-card" style="margin-top: 20px;">
        <div slot="header" class="clearfix">
          <span>系统信息</span>
        </div>
        <el-row>
          <el-col :span="8"><strong>系统版本:</strong> {{ systemInfo.version }}</el-col>
          <el-col :span="8"><strong>内存使用:</strong> {{ systemInfo.memoryUsage }}MB</el-col>
          <el-col :span="8"><strong>处理器负载:</strong> {{ systemInfo.cpuLoad }}%</el-col>
        </el-row>
      </el-card>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      evmConfig: {
        selectedEVMs: ['Geth', 'Besu']
      },
      testEnvConfig: {
        gasLimit: 8000000,
        maxStackDepth: 1024,
        storageSize: 512
      },
      testCaseConfig: {
        opcodeRange: 'all',
        mutationFrequency: 50
      },
      mutationStrategyConfig: {
        conditionalOperatorWeight: 0.25,
        arithmeticOperatorWeight: 0.2,
        loopOperatorWeight: 0.15,
        iterationLimit: 100,
        performanceThreshold: 85
      },
      logConfig: {
        logLevel: 'normal',
        reportFormat: 'pdf'
      },
      systemInfo: {
        version: 'v1.0.0',
        memoryUsage: 256,
        cpuLoad: 45
      }
    }
  }
}
</script>

<style scoped>
.system-settings {
  padding: 20px;
}

.el-card {
  margin-bottom: 20px;
}
</style>
